﻿@model List<TMall.ManageSite.ViewModel.MenuVM>
@using (Html.BeginForm("Index", "Menu", FormMethod.Post, new { @id = "pagerForm" }))
{
    @Html.Hidden("PageIndex", "1")
    @Html.Hidden("PageSize", "20")
    @Html.Hidden("OrderField", "Sort")
    @Html.Hidden("OrderDirection", "asc")
}
@{var navId = ViewBag.navId;}
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" action="@Url.Action("Index")"  method="post">
    @Html.Hidden("navId")
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    一级菜单： @Html.DropDownList("MenuIndexLevel1", ViewBag.MenuLevel1List as List<SelectListItem>,
                         new
                         {
                             @class = "combox",
                             @ref = "MenuIndexLeve12",
                             @refUrl = "/Management/Menu/GetComboxAll/{value}"
                         })
                </td>
                <td>
                    二级菜单： @Html.DropDownList("MenuIndexLeve12", ViewBag.MenuLevel2List as List<SelectListItem>,
                    new { @class = "combox" })
                </td>
                <td>
                    菜单状态： @Html.DropDownList("StatusDB", ViewBag.StatusList as List<SelectListItem>).ForSearch(QueryMethod.Equal)
                </td>
            </tr>
            @*<tr>
                <td>
                    菜单名称：@Html.TextBox("ModuleName", ViewData["ModuleName"]).ForSearch(QueryMethod.Like)
                </td>
                <td>
                    菜单状态： @Html.DropDownList("StatusDB", ViewBag.StatusList as List<SelectListItem>).ForSearch(QueryMethod.Equal)
                </td>
            </tr>*@
        </table>
        <div class="subBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                检索</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li>
                @Html.ActionLinkEx("添加", ViewData["navId"].ToString(), "Add", new { @class = "add", @target = "dialog", @title = "添加菜单", @rel = "menu", @fresh = "false" })
            </li>
            <li>
                @Html.ActionLinkEx("编辑", ViewData["navId"].ToString() + "/{sid_menu}", "Update", new { @class = "edit", @target = "dialog", @title = "编辑菜单", @rel = "menu", @fresh = "true", @width = "560", @height = "355" })
            </li>
            <li>
                @Html.ActionLinkEx("删除", ViewData["navId"].ToString() + "/{sid_menu}", "Delete", new { @class = "delete", @target = "ajaxTodo", @title = "确定要删除该菜单吗?" })
            </li>
            <li class="line">line</li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="137">
        <thead>
            <tr>
                <th width="30" align="left">
                    顺序
                </th>
                <th width="60" align="left">
                    菜单名称
                </th>
                <th width="120" align="left">
                    链接地址
                </th>
                <th width="120" align="left">
                    控制器名称
                </th>
                <th width="50" align="left">
                    是否选中
                </th>
                <th width="50" align="left">
                    状态
                </th>
                <th width="100" align="left">
                    创建时间
                </th>
                <th width="60" align="left">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var x in Model)
            {
                <tr target="sid_menu" rel="@x.SysNo">
                    <td>
                        @x.Sort
                    </td>
                    <td>
                        @x.MenuName
                    </td>
                    <td>
                        @(string.IsNullOrEmpty(@x.MenuLinkUrl) ? "--" : @x.MenuLinkUrl)
                    </td>
                    <td>
                        @(string.IsNullOrEmpty(@x.ModuleController) ? "--" : @x.ModuleController)
                    </td>
                    <td>
                        @x.IsSelected.IsYesOrNo()
                    </td>
                    <td>
                        @x.Status.GetDescription()
                    </td>
                    <td>
                        @x.CreateDate.Format()
                    </td>
                    <td>
                        @Html.ActionLinkEx("删除", ViewData["navId"].ToString() + "/" + x.SysNo, "Delete", new { @class = "btnDel", @target = "ajaxTodo", @title = "确定要删除该菜单吗?" })
                        @Html.ActionLinkEx("编辑", ViewData["navId"].ToString() + "/" + x.SysNo, "Update", new { @class = "btnEdit", @target = "dialog", @title = "编辑菜单", @rel = "menu", @fresh = "true", @width = "560", @height = "355" })
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            @Html.DropDownList("PageSize", new List<SelectListItem>(){ 
                  new SelectListItem(){  Value="10" ,Text="10"},
                  new SelectListItem(){  Value="15" ,Text="15"},
                  new SelectListItem(){  Value="20" ,Text="20"},
                  new SelectListItem(){  Value="30", Text="30"}
             }, new { @onchange = "navTabPageBreak({numPerPage:this.value})", @class = "combox" })
            <span>条，共@{@ViewBag.TotalCount}
                条</span>
        </div>
        <div class="pagination" targettype="navTab" totalcount="@ViewBag.TotalCount" numperpage="@ViewBag.PageSize" pagenumshown="10"
            currentpage="@ViewBag.PageIndex">
        </div>
    </div>
</div>
